package com.py.demo;

import java.lang.reflect.Proxy;

/**
 * @version 1.0
 * @Author: 许啸林
 * @Date: 2021/6/7 16:35
 */
public class PyMain {
    public static void main(String[] args) {
        Class[] proxyInterface = new Class[]{UserDao.class};
        UserDao userDao = new UserDaoImpl();
        UserDao proxyDao = (UserDao) Proxy.newProxyInstance(PyMain.class.getClassLoader(), proxyInterface, new CustomProxyHandler(userDao));
        int age = proxyDao.addAge(18);
        System.out.println("返回值:" + age);
    }
}
